<template>
    <view class="xb-page">
   		<form>
			<view class="search_class"><input placeholder="please insert name"></input></view>
				<view class="base_total_class uni-flex uni-row" >
					<view class=''>总数</view>
					<view class=''>试听</view>
					<view class=''>过期</view>
				<view>
			<view class="" v-for="(item,index) in studentList" :key="index">
				<view class="uni-flex uni-row">
					<view><image></image></view>
					<view class='uni-flex uni-column'>
						<view class=''>姓名:{{formdata.name}}</view>
						<view class=''>总剩余课程数{{formdata.remainrecords}}</view>
					</view>
					</view>
						<checkbox :value="item.name"  @change="check(item.id,checkids)" />{{item.name}}
					</view>
				</view>
			</view>
		</form>
    </view>
</template>

<script>
	import pageHead from '../../../components/page-head.vue'
    import { quertstus } from '../../../api/getData.js’;
    export default {
        onLoad:function(data){
            search();

        },
          computed: {
              …mapState([’subjectList'])
         },
        data(){ 
            return {
                name:'',
                remainrecords:0,
                checkids:[],
            	formdata:{
            		keyword:'',
            	},
            	studentList:null;

            }

        },
        methods: {
        …mapMutations(['’]),
...mapActions(['']),
        	//跳转到学生详情
        	selectstu(id){
        	 uni.navigateTo({url:''})

        },
        check:function(id,checked){
if(checed){
    var index=checkids.find((v,index,checkids){
        return v==id;
    });
    if(index<0){
        checkids.push(id);
    }
}
else {
    checkids.splice(checkids.findIndex(item => item === id), 1)
}
    
}
        	 async search(){
        	 	uni.showNavigationBarLoading();
                const res=await querystus(formdata);
                if(res.success==true){
                    uni.hideNavigationBarLoading();
                }
        	 else {

        	}
        	},
           

        }
    }
</script>

<style scoped >
    @import "../../../common/uni.css";
</style>
